import 'package:flutter/material.dart';
import 'package:flutter_ok/page/home/home_controller.dart';
import 'package:flutter_ok/widget/double_tap_exit_app.dart';
import 'package:get/get.dart';

class HomePage extends GetView<HomeController> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
          title: Text('首页'),
          leading: IconButton(
            icon: Icon(Icons.add),
            onPressed: () => {},
          )),
      body: DoubleTapExitApp(
        child: Obx(() => controller.mPageList[controller.mSelectedIndex.value]),
      ),
      bottomNavigationBar: Obx(() => BottomNavigationBar(
            type: BottomNavigationBarType.fixed,
            currentIndex: controller.mSelectedIndex.value,
            items: controller.mBottomTabs,
            onTap: (index) {
              controller.switchTab(index);
            },
          )),
    );
  }
}
